package com.xikeda.controller;

import com.xikeda.model.EvaluateTable;
import com.xikeda.service.imp.EvaluateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author Xiao Linqing
 * @date 2020/6/8 8:25
 */
@Controller
public class EvaluateController {
    @Resource
    private EvaluateService evaluateService;
    public EvaluateService getEvaluateService() {
        return evaluateService;
    }
    @Autowired
    public void setEvaluateService(EvaluateService evaluateService) {
        this.evaluateService = evaluateService;
    }
    @RequestMapping("/evaluate")
    @ResponseBody
    public String evaluate(HttpServletRequest request,HttpServletResponse response){
        EvaluateTable evaluateTable=new EvaluateTable();
        evaluateTable.setCourier_evaluate(request.getParameter("courier_evaluate"));
        evaluateTable.setGood_evaluate(request.getParameter("good_evaluate"));
        evaluateTable.setCourier_level(Integer.parseInt(request.getParameter("courier_level")));
        evaluateTable.setCourier_id(Integer.parseInt(request.getParameter("courier_id")));
        evaluateTable.setUser_id(Integer.parseInt(request.getParameter("user_id")));
        this.getEvaluateService().userevaluate(evaluateTable);
        /*
        int j=Integer.parseInt(request.getParameter("courier_id"));
        int k=Integer.parseInt(request.getParameter("user_id"));*/
        /*evaluateTable.setCourier_level(i);
        evaluateTable.setCourier_id(j);
        evaluateTable.setUser_id(k);*/
     return "Evaluation submitted successfully";
    }



    @RequestMapping("test9")
    public String InquiryExpress1(HttpServletRequest request, HttpServletResponse response){
        return "demo";
    }
}
